Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layering items and item variants on specific furniture and terrain #52632

Merged
merged 11 commits into from
Nov 12, 2021

Conversation

bombasticSlacks
Copy link
Contributor

@bombasticSlacks bombasticSlacks commented Nov 4, 2021

Summary

Content "Layering items and item variants on specific furniture and terrain"

Purpose of change

fixes #52616

Describe the solution

Implements a new unsorted map per tileset that reads from a file called layering.json if it is available and stores additional info for the tile to layer items when doing render calls. #52616 more clearly explains the what and why.

I believe this now works correctly and renders as would be expected

Describe alternatives you've considered

A few details of implementation could be modified. For displaying weighted overlays consistently I've added a random seed per item. That could instead be per tile, furniture piece etc.

Somehow I'm sure this could be coupled more deeply into the data / json but since it is tileset specific I think it should live there.

Testing

Load up the game, build a desk, put a laptop and a pen on the desk.

use this ultica_custom that contains mock ups to test the functionality
ultica_custom.zip

Additional context

Here are some tests using mockup layering sprites I have a single laptop layer sprite and 2 pen sprites. There is an equal chance a pen will be the left side or right side sprite. (for mockup purposes only one has the black underline usual to Ultica):

Just drawing laptops and pens on top of the desk even at a distance:
image

You get the highlight for additional items when close enough to see in the container:
image

If the topmost item is not already been rendered as a layer sprite it will also draw on the tile as normal (in this case a combat knife):
image

@bombasticSlacks bombasticSlacks marked this pull request as draft November 4, 2021 16:08
@Maleclypse Maleclypse added the SDL: Tiles / Sound Tiles visual interface and sounds. label Nov 5, 2021
@Maleclypse
Copy link
Member

I've guessed on the label here. Let me know if I need to change it.

src/cata_tiles.cpp Outdated Show resolved Hide resolved
@BrettDong BrettDong added the [C++] Changes (can be) made in C++. Previously named `Code` label Nov 5, 2021
@bombasticSlacks bombasticSlacks marked this pull request as ready for review November 5, 2021 19:26
@bombasticSlacks bombasticSlacks changed the title [WIP]Layering items and item variants on specific furniture and terrain Layering items and item variants on specific furniture and terrain Nov 5, 2021
@kevingranade kevingranade merged commit 610e7d5 into CleverRaven:master Nov 12, 2021
Saicchi pushed a commit to Saicchi/Cataclysm-DDA that referenced this pull request Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` SDL: Tiles / Sound Tiles visual interface and sounds.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tileset defined variant item sprites by context
4 participants